/**
 * 
 */
package guice.command.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * 
 */
public class MoviesDB {

	private static List<Movie> movieSource = new ArrayList<Movie>();

	private static Map<String, Movie> movies = new HashMap<String, Movie>();

	static {
		movieSource.add(new Movie("True Lies", new String[] { "Arnold", "Jamie Lee Curtis" }, 1994));
		movieSource.add(new Movie("Rocky", new String[] { "Sylvestor Stallone", "Talia Shire" }, 1976));
		movieSource.add(new Movie("First Blood", new String[] { "Sylvestor Stallone", "Richard Crenna" }, 1982));
		movieSource.add(new Movie("Terminator", new String[] { "Arnold", "Linda Hamilton" }, 1984));
		movieSource.add(new Movie("Notting Hill", new String[] { "Hugh Grant", "Julia Roberts" }, 1992));

		// now register into the map
		for (Movie m : movieSource) {
			movies.put(m.getTitle(), m);
		}
	}

	public static Movie getMovie(String title) {
		if (movies.containsKey(title))
			return movies.get(title);
		return null;
	}

}
